﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace QualitySupervision.Migrations
{
    public partial class _1 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Contracts",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProjectNo = table.Column<string>(nullable: true),
                    Area = table.Column<string>(nullable: true),
                    ContractKind = table.Column<string>(nullable: true),
                    EntrustMoney = table.Column<float>(nullable: false),
                    CostMoney = table.Column<float>(nullable: true),
                    PriceExcludingTax = table.Column<float>(nullable: true),
                    SettlementMoney = table.Column<float>(nullable: true),
                    SettlementMoneyExcludingTax = table.Column<float>(nullable: true),
                    Tax = table.Column<float>(nullable: true),
                    MaintenanceCycle = table.Column<string>(nullable: true),
                    Zhousanbeizhu = table.Column<string>(nullable: true),
                    Supplier = table.Column<string>(nullable: true),
                    Contacts = table.Column<string>(nullable: true),
                    CreateTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Contracts", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "Departments",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    departmentName = table.Column<string>(nullable: true),
                    leve = table.Column<string>(nullable: true),
                    departmentId = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Departments", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "FileSystemItems",
                columns: table => new
                {
                    FileId = table.Column<Guid>(nullable: false),
                    FileCode = table.Column<string>(nullable: true),
                    OriginFileName = table.Column<string>(nullable: true),
                    NewFileName = table.Column<string>(nullable: true),
                    FileType = table.Column<string>(nullable: true),
                    FileVirtualPath = table.Column<string>(nullable: true),
                    FileFullPath = table.Column<string>(nullable: true),
                    FileSize = table.Column<long>(nullable: false),
                    FileExtension = table.Column<string>(nullable: true),
                    CreateTime = table.Column<DateTime>(nullable: false),
                    OSPlatform = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FileSystemItems", x => x.FileId);
                });

            migrationBuilder.CreateTable(
                name: "Leagues",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(nullable: true),
                    Country = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Leagues", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Menus",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    iconid = table.Column<int>(nullable: false),
                    authName = table.Column<string>(nullable: true),
                    path = table.Column<string>(nullable: true),
                    order = table.Column<int>(nullable: false),
                    rid = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Menus", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "Projects",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Year = table.Column<int>(nullable: false),
                    SerialNo = table.Column<string>(nullable: true),
                    Area = table.Column<string>(nullable: true),
                    ProjectName = table.Column<string>(nullable: true),
                    EntrustMoney = table.Column<float>(nullable: false),
                    CostMoney = table.Column<float>(nullable: true),
                    PriceExcludingTax = table.Column<float>(nullable: true),
                    SettlementMoney = table.Column<float>(nullable: true),
                    SettlementMoneyExcludingTax = table.Column<float>(nullable: true),
                    MarkUpRate = table.Column<float>(nullable: true),
                    EntrustTime = table.Column<DateTime>(nullable: true),
                    InquiryTime = table.Column<DateTime>(nullable: true),
                    ContractSignTime = table.Column<DateTime>(nullable: true),
                    FinalInspectionTime = table.Column<DateTime>(nullable: true),
                    SettlementTime = table.Column<DateTime>(nullable: true),
                    MaintenanceCycle = table.Column<string>(nullable: true),
                    MobileProjectNo = table.Column<string>(nullable: true),
                    ProjectManager = table.Column<string>(nullable: true),
                    ServiceManager = table.Column<string>(nullable: true),
                    CurrentStage = table.Column<string>(nullable: true),
                    Zhousanbeizhu = table.Column<string>(nullable: true),
                    Supplier = table.Column<string>(nullable: true),
                    Contacts = table.Column<string>(nullable: true),
                    IsFinish = table.Column<string>(nullable: true),
                    IsMaintain = table.Column<string>(nullable: true),
                    Beizhu = table.Column<string>(nullable: true),
                    Income = table.Column<float>(nullable: true),
                    ActuallyIncome = table.Column<float>(nullable: true),
                    IncomeTime = table.Column<DateTime>(nullable: true),
                    OwnerAcceptanceTime = table.Column<DateTime>(nullable: true),
                    CreateTime = table.Column<DateTime>(nullable: true),
                    Contractsignkind1 = table.Column<string>(nullable: true),
                    EntrustMoney1 = table.Column<float>(nullable: true),
                    CostMoney1 = table.Column<float>(nullable: true),
                    PriceExcludingTax1 = table.Column<float>(nullable: true),
                    SettlementMoney1 = table.Column<float>(nullable: true),
                    SettlementMoneyExcludingTax1 = table.Column<float>(nullable: true),
                    Tax1 = table.Column<float>(nullable: false),
                    Contractsignkind2 = table.Column<string>(nullable: true),
                    EntrustMoney2 = table.Column<float>(nullable: true),
                    CostMoney2 = table.Column<float>(nullable: true),
                    PriceExcludingTax2 = table.Column<float>(nullable: true),
                    SettlementMoney2 = table.Column<float>(nullable: true),
                    SettlementMoneyExcludingTax2 = table.Column<float>(nullable: true),
                    Tax2 = table.Column<float>(nullable: false),
                    Contractsignkind3 = table.Column<string>(nullable: true),
                    EntrustMoney3 = table.Column<float>(nullable: true),
                    CostMoney3 = table.Column<float>(nullable: true),
                    PriceExcludingTax3 = table.Column<float>(nullable: true),
                    SettlementMoney3 = table.Column<float>(nullable: true),
                    SettlementMoneyExcludingTax3 = table.Column<float>(nullable: true),
                    Tax3 = table.Column<float>(nullable: false),
                    Contractsignkind4 = table.Column<string>(nullable: true),
                    EntrustMoney4 = table.Column<float>(nullable: true),
                    CostMoney4 = table.Column<float>(nullable: true),
                    PriceExcludingTax4 = table.Column<float>(nullable: true),
                    SettlementMoney4 = table.Column<float>(nullable: true),
                    SettlementMoneyExcludingTax4 = table.Column<float>(nullable: true),
                    Tax4 = table.Column<float>(nullable: false),
                    Sfjs = table.Column<string>(nullable: true),
                    Sfzt = table.Column<string>(nullable: true),
                    Qqjcgszc = table.Column<string>(nullable: true),
                    Sffb = table.Column<string>(nullable: true),
                    Xmbh = table.Column<string>(nullable: true),
                    Qy = table.Column<string>(nullable: true),
                    Nlbm = table.Column<string>(nullable: true),
                    Jsfs = table.Column<string>(nullable: true),
                    Swhzms = table.Column<string>(nullable: true),
                    Sfxmsj = table.Column<string>(nullable: true),
                    Sfcgkjht = table.Column<string>(nullable: true),
                    SfnrPMOgl = table.Column<string>(nullable: true),
                    Jsms = table.Column<string>(nullable: true),
                    Zcms = table.Column<string>(nullable: true),
                    Sfwg = table.Column<string>(nullable: true),
                    Sfcwg = table.Column<string>(nullable: true),
                    Ywjcje = table.Column<string>(nullable: true),
                    Cpyfje = table.Column<string>(nullable: true),
                    Cpzcje = table.Column<string>(nullable: true),
                    Ptszyy = table.Column<string>(nullable: true),
                    Zbje = table.Column<string>(nullable: true),
                    Htqyje = table.Column<string>(nullable: true),
                    Ylxsrje = table.Column<string>(nullable: true),
                    Ylxcbje = table.Column<string>(nullable: true),
                    Wtrq = table.Column<string>(nullable: true),
                    Zbrq = table.Column<string>(nullable: true),
                    Zbwtsc = table.Column<string>(nullable: true),
                    Yjhy = table.Column<string>(nullable: true),
                    Erhy = table.Column<string>(nullable: true),
                    Xmfl = table.Column<string>(nullable: true),
                    Xmlx = table.Column<string>(nullable: true),
                    Zdssn = table.Column<string>(nullable: true),
                    Zdssw = table.Column<string>(nullable: true),
                    Ctph = table.Column<string>(nullable: true),
                    Xmjd = table.Column<string>(nullable: true),
                    Ctjd = table.Column<string>(nullable: true),
                    Ctyit = table.Column<string>(nullable: true),
                    Zhyy = table.Column<string>(nullable: true),
                    Yqzysj = table.Column<string>(nullable: true),
                    Xmtdzjrq = table.Column<string>(nullable: true),
                    Qdsj = table.Column<string>(nullable: true),
                    Ssfaxttjsj = table.Column<string>(nullable: true),
                    Ssfatjsj = table.Column<string>(nullable: true),
                    Ssfaqrsj = table.Column<string>(nullable: true),
                    Jhkgsj = table.Column<string>(nullable: true),
                    Kgyqts = table.Column<string>(nullable: true),
                    Sjkgsj = table.Column<string>(nullable: true),
                    Dyccgwcsj = table.Column<string>(nullable: true),
                    Cgwcsj = table.Column<string>(nullable: true),
                    Jhdhsj = table.Column<string>(nullable: true),
                    Dhsj = table.Column<string>(nullable: true),
                    Xmjdsj = table.Column<string>(nullable: true),
                    Xmjdhysj = table.Column<string>(nullable: true),
                    Jhsxsj = table.Column<string>(nullable: true),
                    Sxqyts = table.Column<string>(nullable: true),
                    Sjsxsj = table.Column<string>(nullable: true),
                    Yzcqsj = table.Column<string>(nullable: true),
                    Mgssjcysj = table.Column<string>(nullable: true),
                    Yzzysj = table.Column<string>(nullable: true),
                    Mgsjhzysj = table.Column<string>(nullable: true),
                    Zyyqts = table.Column<string>(nullable: true),
                    Mgssjzysj = table.Column<string>(nullable: true),
                    Jhzwsj = table.Column<string>(nullable: true),
                    Zwwcsj = table.Column<string>(nullable: true),
                    Gxsj = table.Column<string>(nullable: true),
                    Sfyxmsjjdpp = table.Column<string>(nullable: true),
                    Bz = table.Column<string>(nullable: true),
                    Jcgsjsdw = table.Column<string>(nullable: true),
                    Xqhtlxkssj = table.Column<string>(nullable: true),
                    Xqhtlxjssj = table.Column<string>(nullable: true),
                    Zwzt = table.Column<string>(nullable: true),
                    Whjssj = table.Column<string>(nullable: true),
                    Whzt = table.Column<string>(nullable: true),
                    Whlx = table.Column<string>(nullable: true),
                    Whzq = table.Column<string>(nullable: true),
                    Zbzq = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Projects", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "Rights",
                columns: table => new
                {
                    id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    authName = table.Column<string>(nullable: true),
                    level = table.Column<string>(nullable: true),
                    pid = table.Column<int>(nullable: false),
                    path = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Rights", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "roles",
                columns: table => new
                {
                    id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    roleName = table.Column<string>(nullable: true),
                    roleDesc = table.Column<string>(nullable: true),
                    rightid = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_roles", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "Users",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    rid = table.Column<int>(nullable: false),
                    mobile = table.Column<string>(nullable: true),
                    email = table.Column<string>(nullable: true),
                    username = table.Column<string>(nullable: true),
                    password = table.Column<string>(nullable: true),
                    deptmentname = table.Column<string>(nullable: true),
                    dept = table.Column<int>(nullable: false),
                    position = table.Column<string>(nullable: true),
                    mg_state = table.Column<bool>(nullable: true),
                    role_name = table.Column<string>(nullable: true),
                    departmentId = table.Column<string>(nullable: true),
                    name = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Users", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "Clubs",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(nullable: true),
                    LeagueId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Clubs", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Clubs_Leagues_LeagueId",
                        column: x => x.LeagueId,
                        principalTable: "Leagues",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Menus2",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    iconid = table.Column<int>(nullable: false),
                    authName = table.Column<string>(nullable: true),
                    path = table.Column<string>(nullable: true),
                    order = table.Column<int>(nullable: false),
                    MenuID = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Menus2", x => x.ID);
                    table.ForeignKey(
                        name: "FK_Menus2_Menus_MenuID",
                        column: x => x.MenuID,
                        principalTable: "Menus",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Fujians",
                columns: table => new
                {
                    FileId = table.Column<Guid>(nullable: false),
                    ProjectID = table.Column<int>(nullable: false),
                    Uploader = table.Column<string>(nullable: true),
                    Rid = table.Column<string>(nullable: true),
                    RoleName = table.Column<string>(nullable: true),
                    FileKind = table.Column<string>(nullable: true),
                    FileCode = table.Column<string>(nullable: true),
                    OriginFileName = table.Column<string>(nullable: true),
                    NewFileName = table.Column<string>(nullable: true),
                    FileType = table.Column<string>(nullable: true),
                    FileVirtualPath = table.Column<string>(nullable: true),
                    FileFullPath = table.Column<string>(nullable: true),
                    FileSize = table.Column<long>(nullable: false),
                    FileExtension = table.Column<string>(nullable: true),
                    CreateTime = table.Column<DateTime>(nullable: false),
                    OSPlatform = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Fujians", x => x.FileId);
                    table.ForeignKey(
                        name: "FK_Fujians_Projects_ProjectID",
                        column: x => x.ProjectID,
                        principalTable: "Projects",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Messages",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Content = table.Column<string>(nullable: true),
                    CreateTime = table.Column<DateTime>(nullable: true),
                    ProjectID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Messages", x => x.ID);
                    table.ForeignKey(
                        name: "FK_Messages_Projects_ProjectID",
                        column: x => x.ProjectID,
                        principalTable: "Projects",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Players",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(nullable: true),
                    ClubId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Players", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Players_Clubs_ClubId",
                        column: x => x.ClubId,
                        principalTable: "Clubs",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Clubs_LeagueId",
                table: "Clubs",
                column: "LeagueId");

            migrationBuilder.CreateIndex(
                name: "IX_Fujians_ProjectID",
                table: "Fujians",
                column: "ProjectID");

            migrationBuilder.CreateIndex(
                name: "IX_Menus2_MenuID",
                table: "Menus2",
                column: "MenuID");

            migrationBuilder.CreateIndex(
                name: "IX_Messages_ProjectID",
                table: "Messages",
                column: "ProjectID");

            migrationBuilder.CreateIndex(
                name: "IX_Players_ClubId",
                table: "Players",
                column: "ClubId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Contracts");

            migrationBuilder.DropTable(
                name: "Departments");

            migrationBuilder.DropTable(
                name: "FileSystemItems");

            migrationBuilder.DropTable(
                name: "Fujians");

            migrationBuilder.DropTable(
                name: "Menus2");

            migrationBuilder.DropTable(
                name: "Messages");

            migrationBuilder.DropTable(
                name: "Players");

            migrationBuilder.DropTable(
                name: "Rights");

            migrationBuilder.DropTable(
                name: "roles");

            migrationBuilder.DropTable(
                name: "Users");

            migrationBuilder.DropTable(
                name: "Menus");

            migrationBuilder.DropTable(
                name: "Projects");

            migrationBuilder.DropTable(
                name: "Clubs");

            migrationBuilder.DropTable(
                name: "Leagues");
        }
    }
}
